#define _CRT_SECURE_NO_WARNINGS 1

class Solution {
public:
    int winningPlayerCount(int n, vector<vector<int>>& pick) {
        int count = 0;
        for (int i = 0; i < n; ++i)
        {
            map<int, int> m1;
            for (int j = 0; j < pick.size(); ++j)
            {
                if (pick[j][0] != i)
                {
                    continue;
                }

                m1[pick[j][1]]++;
            }

            for (auto& e : m1)
            {
                if (e.second > i)
                {
                    count++;
                    break;
                }
            }
        }

        return count;
    }
};